package com.tianji.api.client.promotion;

import com.tianji.api.client.promotion.fallback.PromotionClientFallback;
import com.tianji.api.dto.promotion.CouponDiscountDTO;
import com.tianji.api.dto.promotion.OrderCouponDTO;
import com.tianji.api.dto.promotion.OrderCourseDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "promotion-service",fallbackFactory = PromotionClientFallback.class)
public interface PromotionClient {

    @PostMapping("/available")
    List<CouponDiscountDTO> queryAvailableCoupons(
            @RequestBody List<OrderCourseDTO> courses);

    @PostMapping("/discount")
    CouponDiscountDTO queryCouponDiscount(@RequestBody OrderCouponDTO orderCouponDTO);

    @PutMapping("/use")
    void useCoupon(@RequestParam("couponIds") List<Long> UserCouponIds);

    @PutMapping("/refund")
    void refundCoupon(@RequestParam("couponIds") List<Long> UserCouponIds);

    @GetMapping("/rules")
    List<String> queryDiscountRules(
            @RequestParam("couponIds") List<Long> userCouponIds);
}
